Add test-case that reproduces this bug. Differential Revision: https://phabricator.services.mozilla.com/D46355 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1582190 gecko-commit: 650cdeb643911e1556b1711bebde86f5f6059154 gecko-integration-branch: autoland gecko-reviewers: jib
diff --git a/webrtc/RTCPeerConnection-createDataChannel.html b/webrtc/RTCPeerConnection-createDataChannel.html index 8a13155..58e757b 100644 --- a/webrtc/RTCPeerConnection-createDataChannel.html +++ b/webrtc/RTCPeerConnection-createDataChannel.html
@@ -7,6 +7,10 @@ <script> 'use strict'; +const stopTracks = (...streams) => { + streams.forEach(stream => stream.getTracks().forEach(track => track.stop())); +}; + // Test is based on the following revision: // https://rawgit.com/w3c/webrtc-pc/1cc5bfc3ff18741033d804c4a71f7891242fb5b3/webrtc.html @@ -697,6 +701,53 @@ }, 'New data channel should be in the connecting state after creation (after connection ' + 'establishment)'); +promise_test(async t => { + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + t.add_cleanup(() => pc2.close()); + const stream = await getNoiseStream({audio: true, video: true}); + t.add_cleanup(() => stopTracks(stream)); + const audio = stream.getAudioTracks()[0]; + const video = stream.getVideoTracks()[0]; + pc1.addTrack(audio, stream); + pc1.addTrack(video, stream); + await createDataChannelPair(pc1, pc2); +}, 'addTrack, then createDataChannel, should negotiate properly'); + +promise_test(async t => { + const pc1 = new RTCPeerConnection({bundlePolicy: "max-bundle"}); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + t.add_cleanup(() => pc2.close()); + const stream = await getNoiseStream({audio: true, video: true}); + t.add_cleanup(() => stopTracks(stream)); + const audio = stream.getAudioTracks()[0]; + const video = stream.getVideoTracks()[0]; + pc1.addTrack(audio, stream); + pc1.addTrack(video, stream); + await createDataChannelPair(pc1, pc2); +}, 'addTrack, then createDataChannel, should negotiate properly when max-bundle is used'); + +promise_test(async t => { + const pc1 = new RTCPeerConnection({bundlePolicy: "max-bundle"}); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + t.add_cleanup(() => pc2.close()); + const stream = await getNoiseStream({audio: true, video: true}); + t.add_cleanup(() => stopTracks(stream)); + const audio = stream.getAudioTracks()[0]; + const video = stream.getVideoTracks()[0]; + pc1.addTrack(audio, stream); + pc1.addTrack(video, stream); + const [dc1, dc2] = await createDataChannelPair(pc1, pc2); + + pc2.getTransceivers()[0].stop(); + const dc1Closed = new Promise(r => dc1.onclose = r); + await doSignalingHandshake(pc1, pc2); + await dc1Closed; +}, 'Stopping the bundle-tag when there is a DataChannel in the bundle should kill the DataChannel'); + /* Untestable 6.1. createDataChannel